#include "GlobalSingal.h"
#include <QDebug>

GlobalSingal GSingal;

GlobalSingal::GlobalSingal(QObject *parent) : QObject(parent)
{

}

void GlobalSingal::send_module_name_change(Module_Data *data)
{
    emit this->change_module_name(data->get_module_name());
    emit this->change_module_data(data);
}

void GlobalSingal::set_start_line(ModulePort *start)
{
    this->start_port = start;
}

void GlobalSingal::set_end_line(ModulePort *end)
{
    this->end_port = end;
}

void GlobalSingal::connect_line()
{
    qDebug() << "connect";
    ModuleLine *line = new ModuleLine(this->start_port, this->end_port);
    line->show();

    emit this->add_line(line);
}

void GlobalSingal::clean_line()
{
    this->start_port = nullptr;
    this->end_port = nullptr;
}
